<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>登录</title>
    <base href=http://localhost/campus/">
    <link rel="shortcut icon" href="static/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="static/css/login.css">
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css"/>
    <script src="static/js/jquery.min.js"></script>
    <script src="layui/layui.js" charset="utf-8"></script>
</head>

<body>
<%
    String contextPath = request.getContextPath();
    application.setAttribute("projectUrl", contextPath);
%>
<div class="login">
    <div class="center">
        <div id="div_login">
            <div class="inputLi">
                <h1 class="title">Login</h1>
                <p id="error_tip">
                    <c:if test="${sessionScope.message !=null}">
                        ${sessionScope.message}
                    </c:if>
                </p>
            </div>
            <form id="login_form" action="user/login" method="post">
                <div class="inputLi">
                    <strong>账户</strong>
                    <input id="username" name="username" type="text" placeholder="手机号\用户名">
                </div>
                <div class="inputLi">
                    <strong>密码</strong>
                    <input id="password" name="password" type="password" placeholder="请输入密码">
                </div>
            </form>
            <div class="inputLi">
                <button id="login">登录</button>
            </div>
            <p class="tip" style="float: left;"><a href="user/registerOrForget?isRegister=false">忘记密码?</a></p>
            <p class="tip" style="float: right;"><a href="user/registerOrForget?isRegister=true">没有账号，去注册?</a></p>
        </div>
    </div>
</div>
</body>
<script type="text/javascript">
    $(document).ready(function () {
        $("#login").click(function () {
            var username = $("#username").val();
            var password = $("#password").val();
            if (username === "" || password === "") {
                $("#error_tip").text("用户名或密码不能为空");
            } else {
                $("#error_tip").text("");
                $("#login_form").submit();
            }
        });
    });

</script>
</html>
